package com.chen.demohystriyresttemplate;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@EnableCircuitBreaker  //hystriy  断融
@EnableEurekaClient //eureka
@SpringBootApplication
public class DemoHystriyRestTemplateApplication {

    public static void main(String[] args) {
        SpringApplication.run(DemoHystriyRestTemplateApplication.class, args);
    }

    /**
     *   使用 restTemplate 徐需要注入bean
     * @return
     */
    @LoadBalanced
    @Bean
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }
}
